package com.table.dao;

import java.util.List;

import javax.persistence.EntityManager;
import javax.persistence.Query;

public class GenericDAO extends DAOFactory {

	public List<? extends Object> findAll(Class<? extends Object> clazz){
		
        EntityManager em = getEntityManager();     
        List<? extends Object> listAll = null;
        
        try{     	 	
        	
        	Query q = em.createQuery("Select object(c) from " + clazz.getName() + " c ");
        	listAll = q.getResultList();
        
        }catch (Exception e) {
        	e.printStackTrace();
        }finally{
            em.close();
        }
		
		return listAll;
	}
	
}
